{% extends "KickerMainBundle::layout.html.twig" %}


{% block sidebar %}
<ul class="nav nav-list">
    <li class="nav-header"><h5>Team Options</h5></li>
    <li {% if menu == 'display' %} class="active" {% endif %}><a href="{{ path('_team_display') }}">Display teams</a></li>
    <li {% if menu == 'add' %} class="active" {% endif %}><a href="{{ path('_team_add') }}">Add team</a></li>
</ul>
{% endblock %}

{% block content %}
<div>
    {% if menu == 'display' %}
        <fieldset>
            <legend><h2>List Teams</h2></legend>
            {% if teams %}
                {% for key, team in teams %}  
            <div class='hero-unit'>
                <h2>{% if team.name %} {{team.name}} {% else %} Unknown {% endif %}</h2>
                {% if team.logo %}
                <img style='display: inline' class="logo pull-right img-circle" src="/{{team.getLogo().getWebPath()}}" height="60" width="60">
                {% endif %}
                <div class='row'>
                    <div class='span3'><b>Player1: </b> {{ team.player1 }}</div>
                    <div class='span3'><b>Email: </b> {{ team.email1 }}</div>
                </div>
                <div class='row'>
                    <div class='span3'><b>Player2: </b> {{ team.player2 }}</div>
                    <div class='span3'><b>Email: </b> {{ team.email2 }}</div>
                </div>
                <div class="row">
                    <a href="{{path('_team_remove', {'id' : team.id}) }}"><button  class="btn btn-primary pull-right">Remove Team</button></a>
                    <a href="{{path('_team_edit', {'id' : team.id}) }}"><button class="btn btn-primary pull-right">Edit Team</button></a>
                </div>
            </div>
                {% endfor %}
            {% else %}
            <p>There are no teams</p>
            {% endif %}
        </fieldset>
    {% endif %}

    {% if menu == 'add' or menu == 'edit'%}
        <fieldset>
            <legend><h2 class=''>
            {% if menu == 'add' %} Create Team {% endif %}
            {% if menu == 'edit' %} Edit Team {% endif %}
            </h2></legend>
            {% include "KickerMainBundle:Team:add_edit.html.twig" %}
        </fieldset>
    {% endif %}
    </div>
{% endblock %}